{% extends 'base.html' %}
{% block title %}
    文章分类
{% endblock %}
{% block styles %}
    {{ super() }}
    <style>
        #container {
            width: 1200px;
            margin: 0 auto;
        }

        .article {
            width: 90%;
            margin: 20px auto;
            padding: 5px 10px;
            background-color: rgba(131, 202, 227, 0.7);
            border-bottom: 1px solid gray;
        }

        .article p {
            font-size: 14px;
        rgba(75, 75, 74, 1.00);
        }

        .article h4 a {
            color: rgba(80, 80, 79, 1.00);
        }

        .article h4 a:hover {
            color: black;
        }

        .article div span {
            margin-left: 20px;
        }

        .article div {
            margin-bottom: 18px;
        }
    </style>
{% endblock %}

{% block newcontent %}
    <div id="container">
        {% for article in paginate.items %}
            <div class="article">
                <h4><a href="{{ url_for('article.article_detail') }}?aid={{ article.id }}">{{ article.title }}</a></h4>
                <p>
                    <span>作者：{{ article.user.username }}</span>
                    <br>
                    <br>
                <div>{{ article.content | cdecode |safe }}</div>
                </p>
                <div style="color: #1a1a1a">
                    <span style="margin-left: 0 ">发表时间:{{ article.pdatetime }}</span>
                    <span>收藏:{{ article.save_num }}</span>
                    <span>点击量:{{ article.click_num }}</span>
                </div>
            </div>
        {% endfor %}
        <nav aria-label="Page navigation" class="col-md-offset-5">
            <ul class="pagination">
                <!--   pagination.prev_num 判断是否存在上一页，如果存在则可以点击，否则不能点击             -->
                <li {% if not paginate.prev_num %} class="disabled" {% endif %}><a
                        href="{{ url_for('article.type_search') }}?page={{ paginate.prev_num }}&tid={{ type.id }}"
                        aria-label="Previous"><span aria-hidden="true">&laquo;</span></a>
                </li>
                {% for page_num in range(1,paginate.pages + 1) %}
                    <li {% if paginate.page== page_num %} class="active" {% endif %}><a
                            href="{{ url_for('article.type_search') }}?page={{ page_num }}&tid={{ type.id }}">{{ page_num }} </a></li>
                {% endfor %}
                <!--   pagination.has_next 判断是否存在上一页，如果存在则可以点击，否则不能点击             -->
                <li {% if not paginate.has_next %} class="disabled" {% endif %}>
                    <a href="{{ url_for('article.type_search') }}?page={{ paginate.next_num }}&tid={{ type.id }}" aria-label="Next">
                        <span aria-hidden="true">&raquo;</span>
                    </a>
                </li>
            </ul>
        </nav>
    </div>
{% endblock %}